package event;
import java.awt.*;

import user.source.TankClient;
/**
 * 
 * @author 
 *
 */
public class Explode {
	int x,y;
	private boolean live = true;
	
	private TankClient tc;
	
	/**
	 * 爆炸的范围
	 */
	int[] explodeRange = {2,4,8,16,32,20,10,1};
	
	/**
	 * 记录爆炸进行到了第几步
	 */
	int step = 0;
	
	public Explode(int x,int y,TankClient tc) {
		this.x = x;
		this.y = y;
		this.tc = tc;
	}
	
	
	public void draw(Graphics g) {
		
		if(!live) {
			tc.explodes.remove(this);
			return;
		}
		if(step == explodeRange.length) {
			live = false;
			step = 0;
			return ;
		}
		
		Color c = g.getColor();
		g.setColor(Color.ORANGE);
		g.fillOval(x, y, explodeRange[step], explodeRange[step]);
		g.setColor(c);
		
		step++;
	}
	
}
